const mongoose = require('mongoose');

const commentSchema = new mongoose.Schema({
  mean: String,
  userId: {
    type: mongoose.Schema.Types.ObjectId,
    ref: 'User', // 假设 'User' 是你的用户模型名称
  },
}, {
  toJSON: {
    virtuals: true,
    transform: (doc, ret) => {
      ret.id = ret._id.toString();
      delete ret._id;
    },
  },
  versionKey: false,
});

const Comment = mongoose.model('Comment', commentSchema);

module.exports = Comment;
